home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / lines < prev    next >
Text File  |  1995-03-31  |  3KB  |  152 lines

  1. Article 5340 of comp.sys.handhelds:
  2. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!mentor.cc.purdue.edu!ahernsd
  3. From: ahernsd@mentor.cc.purdue.edu (Dynastar)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: HP48sx program: lineart (very simple)
  6. Message-ID: <8741@mentor.cc.purdue.edu>
  7. Date: 26 Mar 91 06:54:00 GMT
  8. Organization: Purdue University
  9. Lines: 139
  10.  
  11. Ok, here is my first posting of an HP program.
  12.  
  13. It is a program that I have vowed to write on every computer I
  14. touch.  (although going graphics routines on a dumb terminal in
  15. UNIX would be interesting...)
  16.  
  17. This a program that I'm sure you all have seen somewhere.
  18. It bounces a line around the screen, mirroring it as it goes.
  19. Various versions of the program have the line erasing itself
  20. after a while, but I'm working on that version.  The program
  21. also does a little beep thing when a line hits a wall if you
  22. have your beeps on.
  23.  
  24. Just download the whole thing to the 48 using ASCII transfer
  25. and press LINES to begin the thing.  It is a nice little demo
  26. of the 48's graphics.  It also makes neat images to DISS into
  27. one another!
  28.  
  29. The whole program takes up 1667.5 bytes.  Does anyone know of
  30. a way to reduce this size?  I should be able to have this program
  31. in less than 1K, but I don't know of anyway to reduce my code.
  32.  
  33. (Yes I know there are a lot of stupid things in this program, but
  34.  go ahead and yell at me, I'm willing to learn.)
  35.  
  36. Happy programming!
  37.  
  38. -----------------hmmmm, I wonder what this line means?---------
  39. %%HP: T(3)A(R)F(.);
  40. DIR
  41.   LINES
  42.     \<< { # 0d # 0d }
  43. PVIEW
  44.       DO INIT ERASE
  45.         DO 1
  46. 'COUNT' STO+ FIXP
  47. R1 R2 C1 C2 MLINE
  48. CR1 'R1' STO+ CR2
  49. 'R2' STO+ CC1 'C1'
  50. STO+ CC2 'C2' STO+
  51.           CASE 'R1<
  52. 1' 'R1>63' OR
  53.             THEN
  54. UR1
  55.             END 'R2
  56. <1' 'R2>63' OR
  57.             THEN
  58. UR2
  59.             END 'C1
  60. <1' 'C1>130' OR
  61.             THEN
  62. UC1
  63.             END 'C2
  64. <1' 'C2>130' OR
  65.             THEN
  66. UC2
  67.             END
  68.           END
  69.         UNTIL COUNT
  70. 20 ==
  71.         END
  72.       UNTIL 0
  73.       END
  74.     \>>
  75.   INIT
  76.     \<< RAND 130 *
  77. 'C1' STO RAND 130 *
  78. 'C2' STO RAND 64 *
  79. 'R1' STO RAND 64 *
  80. 'R2' STO RAND 10 *
  81. 5 - 'CR1' STO RAND
  82. 10 * 5 - 'CR2' STO
  83. RAND 10 * 5 - 'CC1'
  84. STO RAND 10 * 5 -
  85. 'CC2' STO 0 'COUNT'
  86. STO FIXP
  87.     \>>
  88.   MLINE
  89.     \<< \-> R1 R2 C1 C2
  90.       \<< C1 R1 DCONV
  91. C2 R2 DCONV TLINE
  92. 130 C1 - R1 DCONV
  93. 130 C2 - R2 DCONV
  94. TLINE C1 64 R1 -
  95. DCONV C2 64 R2 -
  96. DCONV TLINE 130 C1
  97. - 64 R1 - DCONV 130
  98. C2 - 64 R2 - DCONV
  99. TLINE
  100.       \>>
  101.     \>>
  102.   DCONV
  103.     \<< R\->B SWAP R\->B
  104. SWAP 2 \->LIST
  105.     \>>
  106.   FIXP
  107.     \<< R1 0 RND 'R1'
  108. STO R2 0 RND 'R2'
  109. STO C1 0 RND 'C1'
  110. STO C2 0 RND 'C2'
  111. STO
  112.     \>>
  113.   BOING
  114.     \<< 2000 10000
  115.       FOR I I .01
  116. BEEP 2000
  117.       STEP
  118.     \>>
  119.   GR
  120.     \<< 1.5 RAND -
  121. NEG
  122.     \>>
  123.   UR1
  124.     \<< GR CR1 * 0
  125. RND 'CR1' STO CR1
  126. 'R1' STO+ BOING
  127.     \>>
  128.   UR2
  129.     \<< GR CR2 * 0
  130. RND 'CR2' STO CR2
  131. 'R2' STO+ BOING
  132.     \>>
  133.   UC1
  134.     \<< GR CC1 * 0
  135. RND 'CC1' STO CC1
  136. 'C1' STO+ BOING
  137.     \>>
  138.   UC2
  139.     \<< GR CC2 * 0
  140. RND 'CC2' STO CC2
  141. 'C2' STO+ BOING
  142.     \>>
  143. END
  144. ---------------------finally!---------------
  145. -- 
  146. Sean Ahern ----------- Purdue University --------- ahernsd@mentor.cc.purdue.edu
  147. Dan Quayle: "Japan is an important ally of ours.  Japan and the United States
  148.              of the Western industrialized capacity, 60 percent of the GNP,
  149.   :-)        two countries.  That's a statement in and of itself."
  150.  
  151.  
  152.